theServer=thinkleaf
theFolder=~/thinkleaf/api
case "$1" in
    "s" | "sync")
        rsync -avzP --delete --progress  --exclude-from=.gitignore ./android/app/build/outputs/apk/release/ thinkleaf:/usr/local/nginx/html/app
        # rsync -avzP \
        # --delete --progress \
        # --exclude-from=.gitignore \
        # ./ $theServer:$theFolder
    ;;
    "l" | "logs")
        ssh $theServer "cd $theFolder && docker-compose logs -f --tail=50"
    ;;
    "p" | "ps")
        ssh $theServer "cd $theFolder && docker-compose ps"
    ;;
    "b" | "build")
        ssh $theServer "cd $theFolder && docker-compose build api"
    ;;
    "r" | "restart")
        ssh $theServer "cd $theFolder && docker-compose restart"
    ;;
    "u" | "up")
        ssh $theServer "cd $theFolder && docker-compose up -d"
    ;;
    "ud" | "update doc")
        npm run doc
        ./sync.sh s $theServer
    ;;
    "d" | "down")
        ssh $theServer "cd $theFolder && docker-compose down"
    ;;
    "du" | "down and up")
        ./sync.sh d $theServer
        ./sync.sh u $theServer
    ;;
    "ra" | "rebuild api")
        ./sync.sh s $theServer
        ./sync.sh b $theServer
        ./sync.sh du $theServer
    ;;
    *)
        echo 'do nothing'
    ;;
esac
